package com.gxa.controller.baoBiaoController;

import com.gxa.common.R;
import com.gxa.pojo.*;
import com.gxa.service.baoBiaoService.XiaoShouBaoBiaoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 86156
 */
@RestController
@RequestMapping("/baoBiao/xiaoShouBaoBiao")
@Api(value = "销售报表功能",tags = "销售报表功能API")
@RequiresPermissions("销售报表")
public class XiaoShouBaoBiaoController {


    @Autowired
    private XiaoShouBaoBiaoService xiaoShouBaoBiaoService;

    @GetMapping(value = "/selectXiaoShouMingXi")
    @ApiOperation(value = "销售明细表接口",notes = "接受参数，根据参数返回销售明细",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime",value = "开始时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "endTime",value = "结束时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "keHuId",value = "客户id",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "shangPinId",value = "商品id",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "cangKuId",value = "仓库id",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "zhiYuanId",value = "职员id",paramType = "query",dataType = "String",required = false)
    })
    public R selectXiaoShouMingXi(@RequestParam String startTime,
                                @RequestParam String endTime,
                                @RequestParam(required = false) String keHuId,
                                @RequestParam(required = false) String shangPinId,
                                @RequestParam(required = false) String cangKuId,
                                @RequestParam(required = false) String zhiYuanId) throws ParseException {
        return xiaoShouBaoBiaoService.selectXiaoShouMingXi(startTime,endTime,keHuId,shangPinId,cangKuId,zhiYuanId);
    }

    @GetMapping(value = "/selectWangLaiDanWeiQianKuan")
    @ApiOperation(value = "往来单位欠款表接口",notes = "接受参数，根据参数返回往来单位欠款表",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "chaXunNeiRong",value = "根据此信息查询",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "keHuCheck",value = "客户选择",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "gongYingShangCheck",value = "供应商选择",paramType = "query",dataType = "String",required = false)
    })
    public R selectWangLaiDanWeiQianKuan(@RequestParam(required = false) String chaXunNeiRong,
                                         @RequestParam(required = false) String keHuCheck,
                                         @RequestParam(required = false) String gongYingShangCheck){

        return xiaoShouBaoBiaoService.selectWangLaiDanWeiQianKuan(chaXunNeiRong,keHuCheck,gongYingShangCheck);
    }

}
